/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webserver;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.log4j.PropertyConfigurator;
import servidor.ControladorClientes;
import servidor.Servidor;

/**
 *
 * @author javi
 */
public class WebServer {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String path = "";
        BufferedReader lectorPath = new BufferedReader(new InputStreamReader(System.in));
        try {
            System.out.print("Introduzca la ruta del path de contexto: ");
            path = lectorPath.readLine();
            PropertyConfigurator.configure(ControladorClientes.class.getResource("log4j.properties"));
            if (path.isEmpty()) {
                System.err.println("Debe introducir un path");
                System.exit(1);
            } else {
                Servidor server = new Servidor(12345,path);
                Thread servidor = new Thread(server);
                servidor.start();
            }
        } catch (IOException ex) {
            Logger.getLogger(WebServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
